import { Component, ChangeDetectorRef } from "@angular/core";
import { NavController, NavParams } from "ionic-angular";
import { HttpService } from "../../providers/http.service";
import { CommonFunc } from "../../providers/commonFunc";
import { Storage } from "@ionic/storage";
import { WorkSumCachePage } from "../work-sum-cache/work-sum-cache";

@Component({
  templateUrl: "my-cache.html"
})
export class MyCachePage {
  private title: string; //标题
  private list: any = [];
  constructor(
    private storage: Storage,
    private navController: NavController,
    public cd: ChangeDetectorRef
  ) {
    this.title = "待提交记录";
    this.storage.get("user").then(data => {

      let userId = data.id

      this.storage.get(userId + 'cache').then(data => {
        if (data) {
          this.list = data;
        }

      });

      this.cd.detectChanges();
    });
  }

  detail(p) {
    this.navController.push(WorkSumCachePage, p.cacheData.bsData);
  }
}
